// CCallDlg.cpp : implementation file
//

#include "stdafx.h"
#include "AVChat.h"
#include "CCallDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CCallDlg dialog


CCallDlg::CCallDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CCallDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CCallDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	mServerIP = 0x7f000001;
	mServerPort = SERVER_TCP_PORT;
}


void CCallDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCallDlg)
	DDX_Control(pDX, IDC_IPADDRESS_SERVER, mServerIPCtrl);
	DDX_Control(pDX, IDC_PORT_SERVER, mServerPortCtrl);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CCallDlg, CDialog)
	//{{AFX_MSG_MAP(CCallDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCallDlg message handlers

BOOL CCallDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	mServerIPCtrl.SetAddress(mServerIP);
	CString strPort;
	strPort.Format("%d", mServerPort);
	mServerPortCtrl.SetWindowText(strPort);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CCallDlg::OnOK() 
{
	DWORD  ip = 0;
	if (mServerIPCtrl.GetAddress(ip) == 4)
	{
		mServerIP = ip;
	}

	CString strPort;
	mServerPortCtrl.GetWindowText(strPort);
	mServerPort = atoi(strPort.GetBuffer());
	
	CDialog::OnOK();
}
